<!-- Data Tables -->
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-lg-12">
            <div class="ibox float-e-margins" style="background: white;padding: 10px">
                <!-- 表单标题概要 -->
                <div class="ibox-title">
                    <h5>角色列表</h5>
                    <div class="ibox-tools">
                        <a class="collapse-link">
                            <i class="fa fa-chevron-up"></i>
                        </a>
                        <a class="close-link">
                            <i class="fa fa-times"></i>
                        </a>
                    </div>
                </div>
                <!-- 表单内容 -->
                <div class="ibox-content">
                    <!-- 用户控件（操作） -->
                    {toolbar id="toolbar"}
<<<<<<< HEAD
                         <!-- <div class="btn-group">
                             <button type="button" data-name="access_menu" class="btn btn-primary" data-event-type="view" data-event-value="" data-target="self"><i class="fa fa-certificate" aria-hidden="true" style="margin-right: 2px"> </i>用户权限</button>
                        </div> -->
=======
                    <div class="btn-group">
                        <button type="button" data-name="access_menu" class="btn btn-primary" data-event-type="view" data-event-value="" data-target="self"><i class="fa fa-certificate" aria-hidden="true" style="margin-right: 2px"> </i>用户权限</button>
                    </div>
>>>>>>> 2c2b4c9f7f066292c6bea4532625ea45dbe8d910
                    {/toolbar}
                    <!-- 表格数据 -->
					<table id="table" data-toggle="gridview" class="table" data-url="{:url('admin/role/index')}" data-toolbar="#toolbar" data-show-columns="true" data-page-size="10" data-page-list="[10, 25, 50, All]" data-unique-id="id" data-pagination="true" data-side-pagination="client" data-search="true" data-click-to-select="false">
					    <thead>
							<tr>
								<th data-width="40" data-checkbox="true"></th>
								<th data-width="100" data-field="name">角色名称</th>
								<th data-width="100" data-field="status" data-formatter="format_status">状态</th>
								<th data-width="100" data-field="remark">备注</th>
                                <th data-width="30" data-field="operate"   data-align="center" data-formatter="operateFormatter" data-events="operateEvents">操作</th>
							</tr>
						</thead>
					</table>
                </div>
            </div>
        </div>
    </div>
</div>

<script type="text/javascript">
    function operateFormatter(value, row, index) {
        return [
            '<a class="edit" href="javascript:void(0)" title="{$Think.lang.Edit}">',
            '<i class="fa fa-edit"></i>',
            '</a>  ',
            '<a class="delete" href="javascript:void(0)" title="{$Think.lang.Delete}">',
            '<i class="fa fa-trash"></i>',
            '</a>'
        ].join('');
    }

    var operateEvents = {
        'click .edit': function (e, value, row, index) {
            var param = {
                url: '/admin/role/access_menu',
                data: {id: row.id}
            }
            window.location.href = param.url + '?id=' + param.data.id;

        },
        'click .delete': function (e, value, row, index) {
            $("#table").gridView('deleteModal', 'delete', row)
            
        }
    };

	function format_status(status, row, index) {
		if(status == 1){
			return '启用'
		}else if(status == 0){
			return '禁止'
		}
	}
</script>


